﻿using CPPEI.WebApi;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ENT = CPPEI.ETL.Domain.Entities;
using MOD = CPPEI.ETL.Domain.Models;
using SER = CPPEI.ETL.Domain.Services;

namespace CPPEI.ETL.WebApi.DtSer.ExtDS
{
    /// <summary>
    /// 删除外部扩展服务程序集
    /// </summary>
    [CPPEI.WebApi.AuthPostAction("ExtDS", "DeleteAssembly", "1.0")]
    public class DeleteAssemblyAction : BaseAction<DeleteAssemblyParams, DeleteAssemblyResult>
    {
        protected override ActionResult<DeleteAssemblyResult> OnExecute(ActionContext context,
            SysParameters sysParameters,
            DeleteAssemblyParams opParams)
        {
            ServiceResult serResult = new SER.DeleteService().DeleteExtDSAssembly(opParams.AssemblyId);

            if(serResult.IsSuccess)
            {
                DeleteAssemblyResult result = new DeleteAssemblyResult();
                return new ActionResult<DeleteAssemblyResult>(result);
            }
            else
            {
                return new ActionResult<DeleteAssemblyResult>(serResult.IsSuccess, serResult.ErrorCode, serResult.Message, null);
            }
        }
    }

    public class DeleteAssemblyParams
    {
        public Guid AssemblyId { get; set; }
    }

    public class DeleteAssemblyResult
    {
    }
}
